package level4Assessment;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Date;

public class AuthorisationWriter
{
	public AuthorisationWriter(int transactionNum, char type, String ccNum, String ccExpiryDate, boolean ccValid, String reason)
	{
		try(
			BufferedWriter output = new BufferedWriter(new FileWriter("D:\\Users\\josjenki\\Desktop\\central authorisation's file.csv", true))
			)
			{ 
				output.write(transactionNum + ", " + type+ ", " +ccNum + ","  +  ccExpiryDate + "," + new Date() + "," + ccValid + "," + reason);
				output.newLine();
			}catch(IOException e)
				{
					System.out.println("Exception: " + e);
				}
	}
}
